package ms.unicorn.dsl.valueconverter;

import org.eclipse.xtext.conversion.ValueConverterException;
import org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter;
import org.eclipse.xtext.nodemodel.INode;

public class HEXValueConverter extends AbstractLexerBasedConverter<Integer> {

	@Override
	public Integer toValue(String string, INode node)
			throws ValueConverterException {
		try {
			return Integer.decode(string);
		} catch (IllegalArgumentException e) {
			throw new ValueConverterException(e.getMessage(), node, e);
		}
	}

}
